package cn.sofwin.dubbo.service;
import cn.sofwin.dubbo.dao.UserDao;
import cn.sowfin.dubbo.entity.User;
import cn.sowfin.dubbo.service.UserService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao userDao;

    @Override
    public User login(String username, String password) {
        User user = null;
        if ("zhangshan".equals(username) && "123456".equals(password)) {

            user = new User();
            user.setUsername(username);

        }
        return  user;
    }

    @Override
    public User zc(String username, String password) {
        User user=new User();
        user.setUsername(username);
        user.setPassword(password);

        return user;
    }

    @Override
    public User login2(String username, String password) {
        User user=new User();
        user.setUsername(username);
        user.setPassword(password);
        return  userDao.select(user);
    }

    @Override
    public void zc2(String username, String password) {
        User user=new User();
        user.setUsername(username);
        user.setPassword(password);
        userDao.insert(user);
    }
}
